const fs = require('fs');

var data = require('./data.json')

let user = {
  name: 'wanghao',
  age: 20
}

//创建并添加内容
// fs.writeFileSync('data.json', JSON.stringify(user));

console.log(data);

//修改json文件的内容
data.address = 'beijing';
fs.writeFileSync('data.json', JSON.stringify(data));

